<template>
  <div>
    <el-row>
      <el-col :span="12">
         <el-table :data="userList" border>
      <el-table-column prop="name" label="姓名" align="center"></el-table-column>
      <el-table-column prop="age" label="年龄" align="center"></el-table-column>
      <el-table-column prop="sex" label="性别" align="center"></el-table-column>
      <el-table-column prop="qq" label="QQ" align="center"></el-table-column>
      <el-table-column prop="phone" label="电话" align="center"></el-table-column>
           </el-table>
        <el-button type="primary" @click="test">获取后台数据</el-button>
      </el-col>
    </el-row>

  </div>

</template>

<script>
 import Axios from 'axios';
export default {
  name: 'HelloWorld',
  data () {
    return {
        userList:[]
    }
  },
  methods:{
    test(){
      let that = this
      Axios.get('http://localhost:8888/app/index/').then((response) => {
       that.userList=response.data.users
    })

    }
  },
  created(){
       // this.test()
  }

}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
